UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LBh7CSquQj0jt4uR57oLfXCqFLLfFLS6+x0LcZxaztI=' 
WHERE 
  key_id = '99bde4abfc6444e30f2203af184b1659a605abb8c7588f0a6568406f6c4c127f' 
  AND (
    token = 'LBh7CSquQj0jt4uR57oLfXCqFLLfFLS6+x0LcZxaztI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030