UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eHZvQA89LDphgjAP20gJDLbg9SNKohH/hjl8DvoJ30w='
WHERE
key_id = 'ec38d739cfa55557e3f59092f118f6d1e23d4e75c08b79a9a63763a03207f1bf'
AND (
token = 'eHZvQA89LDphgjAP20gJDLbg9SNKohH/hjl8DvoJ30w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)