UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '27ypnOy5Meb+2ee46fGO2cr/qEQn7f0GJ/fsTgi6Dhs='
WHERE
key_id = '8f20482ef2b83c84731c7b21f4379b1304f60250d37a9098a1c9c40182f8201c'
AND (
token = '27ypnOy5Meb+2ee46fGO2cr/qEQn7f0GJ/fsTgi6Dhs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)