UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+VEC1+VNXm0MtIkB4Y6HTObYpVzS+7nm8KM1Q+WEk8=' 
WHERE 
  key_id = '6adcd0700bb0d47b58c641174ab89254f71af2cec5b7df885f9cc39e70a4f7c7' 
  AND (
    token = 'c+VEC1+VNXm0MtIkB4Y6HTObYpVzS+7nm8KM1Q+WEk8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024