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