UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l6YacgQH7uVJthoIrOr2vdOT5hnFHaXHFhZBULnYiOA='
WHERE
key_id = '8ba24569ed2bb5f2049d5eb774e50d4aaf6893aea7a56ce5134ac48f15a405fb'
AND (
token = 'l6YacgQH7uVJthoIrOr2vdOT5hnFHaXHFhZBULnYiOA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)