UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0FDNF9BIa7lX23wIb57b9L5Z1fTi+T4NZThM39o6adI='
WHERE
key_id = '6d0207c0561246b17d9f72adb64bfadf63f56e0d9d7974190a431c5307309441'
AND (
token = '0FDNF9BIa7lX23wIb57b9L5Z1fTi+T4NZThM39o6adI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)