UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aMoaGwDJW0XkY6T9Uvb0fpZHMbBRJUvA4qmwhAEye1Q='
WHERE
key_id = 'a5309be01434b494c0ea6d4d4a2ddc52f69058be809fff8ea49311172ab3d26f'
AND (
token = 'aMoaGwDJW0XkY6T9Uvb0fpZHMbBRJUvA4qmwhAEye1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)