UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cl9dXA4l8igoPdIIYuPI2lKYCjWCeL0TDg+u+oMUJjE=' 
WHERE 
  key_id = 'b2d5b57df847014f60ae0e4a00e24f57354670727a38fd3f51bc3835f1296918' 
  AND (
    token = 'Cl9dXA4l8igoPdIIYuPI2lKYCjWCeL0TDg+u+oMUJjE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037