UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L2BCQ1qZyYtTZzaunmjaLh9+P2JJ6UXhtWTIavJazgE=' 
WHERE 
  key_id = 'fc40cb10816f67459e966baa468f6485ca2aab4aab7f29f2d6e7b8048c2f1ca4' 
  AND (
    token = 'L2BCQ1qZyYtTZzaunmjaLh9+P2JJ6UXhtWTIavJazgE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037