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