UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6PSQlc5xavan/NWT+3KHgyI07/0Q6VfdXOf7/FTJrHA='
WHERE
key_id = '4c37c8f93334955823989985c163a7a319e1e84134611a16a3f62463a2085afb'
AND (
token = '6PSQlc5xavan/NWT+3KHgyI07/0Q6VfdXOf7/FTJrHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)