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