UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6fClgti/MI5LRLeRI7BrZ3GwR1wHFiE5jBSB+rlY+W8='
WHERE
key_id = 'bd130f7dbadefc9cde20da06cbe8d761de25ca04136c040a398dd08d0999d2b8'
AND (
token = '6fClgti/MI5LRLeRI7BrZ3GwR1wHFiE5jBSB+rlY+W8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)