UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K578QkIHJfVGp2NDvTrSwE2Znc1iyNKHt0ekm5KmjEI='
WHERE
key_id = '759073722a17be8b39ba888df292d7255ecc6f584c713f4e6dafdb36f7b1b269'
AND (
token = 'K578QkIHJfVGp2NDvTrSwE2Znc1iyNKHt0ekm5KmjEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)