UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bdkuuEZPQGuyafIVNH8ul4YWOmzI38uKOH/CKW7Bnsc='
WHERE
key_id = '31be79f101af22e60b518a7fdf436002ead369b4e833d301ddc74f5b4f6ecb87'
AND (
token = 'bdkuuEZPQGuyafIVNH8ul4YWOmzI38uKOH/CKW7Bnsc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)