UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/AuJNb3xINqGQ/0EUYtc0dE13Nc9+T11xPRQiwZPcI8='
WHERE
key_id = 'bdab21fbe5d8201359ab5939e1d1c8a7e875f1a26066985b87ee702df288309d'
AND (
token = '/AuJNb3xINqGQ/0EUYtc0dE13Nc9+T11xPRQiwZPcI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)