UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EKDKtcWqYTlmff2oBtNhTBFfoCDhcGwFaA26alWYmcg='
WHERE
key_id = 'a3b2b3ecadb9d52229c29218324bf7b1e4319f969a1c39e93e5bb1e87ffca519'
AND (
token = 'EKDKtcWqYTlmff2oBtNhTBFfoCDhcGwFaA26alWYmcg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)