UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vMfmm78A3eeIrM73c9v8mlHthc8Fbvcm2fPAnYLy0n8='
WHERE
key_id = '5ed44d0536e0974c2df354a92e88e9bf21113c86805135ac28cda039ebe61d43'
AND (
token = 'vMfmm78A3eeIrM73c9v8mlHthc8Fbvcm2fPAnYLy0n8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)