UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XM5ANICJwRKkdNS0Mdr3v5gU3+uIrWWsFQc6OnHavac='
WHERE
key_id = '62d8451c2eeef0856884a653c09b8f17a2ab2b0521994698135aa12412ca601e'
AND (
token = 'XM5ANICJwRKkdNS0Mdr3v5gU3+uIrWWsFQc6OnHavac='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)