UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4W5CQTMNRWc43Zw9HVQKxpDuZGqPCs/AvtQ14DdeAm8='
WHERE
key_id = '50e31550514d7170436ed62879e0c1d9eee860222a5697b5c5dcb50ab2d23bc2'
AND (
token = '4W5CQTMNRWc43Zw9HVQKxpDuZGqPCs/AvtQ14DdeAm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)