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