UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y50gZqA/xOzOxxU2HgB5HjM5vj9nfyXfSQnZuPRpx4A='
WHERE
key_id = 'a374508059a2ee0bab2ca0013b0e48343cf8fae0a7da5099588bbf58fbdb8186'
AND (
token = 'Y50gZqA/xOzOxxU2HgB5HjM5vj9nfyXfSQnZuPRpx4A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)