UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mxDqcwdzXOTmVlHiT5zzE1WbZiQmc257GrOj6Uvm/VY='
WHERE
key_id = 'bb6ffe06e52e5da1668e06d6f660e9f2c56b635c780ccc9cbe7c5617d20a3e31'
AND (
token = 'mxDqcwdzXOTmVlHiT5zzE1WbZiQmc257GrOj6Uvm/VY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)