UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0yjoSB74Lhk62PW1ByQyq1uCqwwYsX3LUDXpXJLJs5A='
WHERE
key_id = 'b769aa7b0283fd1baf371205990afa2f461c9e25290c5cfbba12c1dcec8e0149'
AND (
token = '0yjoSB74Lhk62PW1ByQyq1uCqwwYsX3LUDXpXJLJs5A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)