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