UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n7+5ER/kRcgyDm6Qp59O/GfrDbobriB6pU4ZRLPcQSo='
WHERE
key_id = '80474f52532f3f8164eff9eefa3420aea80b3d417487a988b2b957137a63e3eb'
AND (
token = 'n7+5ER/kRcgyDm6Qp59O/GfrDbobriB6pU4ZRLPcQSo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)