UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/qaDsGTCJX8tEtyl7+SIYaFyrJ1YpkNp19Wi51uB18g='
WHERE
key_id = 'c58a19b3fc4b92b4489a5f144a38acaf80148045d8e2c1af61fba9df2a0321c4'
AND (
token = '/qaDsGTCJX8tEtyl7+SIYaFyrJ1YpkNp19Wi51uB18g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)