UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ou+SShOBG1m9vn3UjEtuwpLD+zVRlMcCvJ8niFSoutc=' 
WHERE 
  key_id = '2db2f4e548ff55006f2c4e01c7b18c2b3c4d18635120ad44baffe4142123b718' 
  AND (
    token = 'Ou+SShOBG1m9vn3UjEtuwpLD+zVRlMcCvJ8niFSoutc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027