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