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

Query time 0.00035