UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kiyOp0ri7wOTrPgrG6nqyLQnJ1PS7czS/9H+cAc6DGI='
WHERE
key_id = 'c8987a18b1a12d68d15e47bd5893f8576da37486221b607401550b3456a0287a'
AND (
token = 'kiyOp0ri7wOTrPgrG6nqyLQnJ1PS7czS/9H+cAc6DGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)